#!/bin/sh

tmpfile=/tmp/nand+oob.$$

sed '{/^\s*$/d}' | sheeva-ubootenv-encode | sheeva-nandrs-encode >$tmpfile
if [ $(wc -c <$tmpfile) != "135168" ] ; then
    echo "Something went very wrong while encoding:"
    echo "$tmpfile should be 135168 bytes long!"
    echo "I'd better quit before I break anything."
    exit 1
fi
nandwrite -q -n -o -s 0xa0000 /dev/mtd0 -f $tmpfile
rm -f $tmpfile
